Uec3.QueryCompanyDealWindow = Ext.extend(Ext.app.Module,{
	id: 'queryCompanyDeal',
   /*
    * Initialize this module.
    * This function is called at startup (page load/refresh).
    */
   init : function(initParams){
   
   },
  
   getComponent:function(){
   	
   	    var companyDealType_store = getDictionaryStore(Uec3.App.Constants.homeUrl,{group:'companyDeal_dealType'});
	    var companyDealType_combox = getDictionaryComboBox(companyDealType_store,'local','dealType','交易类型','dealType','','');	
   	    companyDealType_store.load();
   	    var companyDeal_store = new Ext.data.JsonStore({
   	          url:Uec3.App.Constants.homeUrl + '/company/queryCompanyDeal.do',
   	          root:'items',
   	          totalProperty:'total',
   	          autoLoad:true,
   	          baseParams:{start:0,limit:10},
   	          fields:['dealName',{name:'dealTypeName',mapping:'dealType'},'description','creatorName','borrow','loan','beginBalance','endBalance',{name:'gmtCreate',type:'date',dateFormat:'Y-m-d H:i:s'}]
   	         /* listeners:{
   	            'beforeload':function(){
                    Ext.MessageBox.wait("正在加载数据...","提示");
                 }
   	          }*/
   	    });
   	
   	    var selModel = new Ext.grid.RowSelectionModel({
   	           moveEditorOnEnter:true,
   	           singleSelect :true
   	    });
   	    
   	    var colModel = new Ext.grid.ColumnModel({
   	         columns:[
          		   	new Ext.grid.RowNumberer(),        		   	
      		 	   	{header:'交易时间',dataIndex:'gmtCreate',renderer:Ext.util.Format.dateRenderer('Y-m-d')},
      		 		{header:'交易名称',dataIndex:'dealName'},
      		 		{header:'交易类型',dataIndex:'dealTypeName',renderer:Ext.util.Format.comboRenderer(companyDealType_combox)},
      		 		{header:'交易人',dataIndex:'creatorName'},
      		 		{header:'支出',dataIndex:'borrow'},
      		 		{header:'转入',dataIndex:'loan'},
      		 		{header:'开始金额',dataIndex:'beginBalance'},
      		 		{header:'结束金额',dataIndex:'endBalance'},
      		 		{header:'摘要',dataIndex:'description'}
          		],
          		defaults: {
          			menuDisabled: true         
       			}
   	    });
   	    
   		var companyDeal_grid = new Ext.grid.GridPanel({
   		     viewConfig:{forceFit:true,scrollOffset:20},	   	   
	   	   	 autoScroll : true,
	   	   	 loadMask:{mag:'公司历史交易查询中,请稍后....'},
	   	   	 titleCollapse:true,
	         colModel:colModel,
	         height:250,
	         selModel:selModel,
	         store:companyDeal_store,	           
	         columnLines :true,
	         bbar: new Ext.PagingToolbar({
		            pageSize:10,
	                store:companyDeal_store,
	                displayInfo: true,
	                displayMsg: '第 {0} - {1} 条  共 {2} 条',
                    emptyMsg: "没有记录"                 
                   /* listeners:{
                        beforechange:function(){
                      		 Ext.MessageBox.wait("正在加载公司服务列表...","提示");	                     
                        },
                        change:function(){
                            Ext.MessageBox.hide();
                        }
                    }*/
		     }) 
   		});
   		
   		return companyDeal_grid;
   },
   
   /**
	* Create this modules window here.
	*/
   createWindow : function(){
    	var desktop = this.app.getDesktop();
        var win = desktop.getWindow('queryDealWindow');
        if (!win) {
			win = desktop.createWindow({
				        id : "queryDealWindow",
						title : '历史交易查询',
						width : 1000,
						height : 500,
						iconCls : 'acc-icon',
					    minWidth:1000,
						maximizable : false,
						resizable:false,
						maximized:false,
						//autoScroll : true,
						constrainHeader : true,
						taskbuttonTooltip : '历史交易查询',
						layout : "fit",
						items : [this.getComponent()]
					});
		}		
    	win.show();         
   }
});